<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>WIKINDX CLASS DOCUMENTATION</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/wikindx2/docs/docs.css" type="text/css" />
</head>

<body bgcolor="#FFFFFF" text="#000000">
<h2>WIKINDX METHODS</h2>
<p><strong>Method:</strong><br />
  
  update()
</p>
<p><strong>Class:</strong><br />

  <a href="sqlClass.html">SQL</a>
<p><strong>Method Call:</strong><br />
  include_once("core/sql/SQL.php");<br />
$db = new SQL();<br />
$db->update(STRING: $table, ASSOC_ARRAY: $setArray, [STRING: $condition]); </p>
<p><strong>Description:</strong><br />
Execute an UPDATE statement.</p>
<p> $setArray is an associative array <i>field => value</i> where <i>field</i> is a field within $table and <i>value</i> is the value you wish to set it to.</p>
<p>Do not add backticks, single-quotes etc. - the SQL class will do this automatically depending on the database we're connected to.</p>
<p><strong>Usage:<br />
</strong>For example (assuming the database object exists within a class as $this->db):
<pre>
	$subTitle = "Beginner's Guide";
	$table = "WKX_resource";
	$setArray = array(
		"title"		=>	"WIKINDX",
		"subtitle"	=>	$subTitle,
		);
	$condition = "WHERE " . $this->db->formatField('id') . "=" . $this->db->tidyInput(666);
	$this->db->update($table, $setArray, $condition);
</pre>
Note that, in this case, <em>$subTitle</em> is internally parsed by the <a href="tidyinputMethod.html">tidyInput()</a> method which will 
suitably escape the single quote in <i>Beginner's Guide</i> while backticks will be added to the fields <em>title</em> and <em>subtitle</em>. As always with a condition clause, you need to you will need to use <a href="formatfieldMethod.html">formatField()</a> and <a href="tidyinputMethod.html">tidyInput()</a> methods explicitly.
<p align="right"><a href="../../index.html">WIKINDX home</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="../../usage/index.html">WIKINDX usage</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="../index.html">WIKINDX classes</a>
</p>
</body>

</html>
